﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;
using CMISLibrary.Libraries;

namespace NPCUS.common
{
    /// <summary>
    /// Interaction logic for Login.xaml
    /// </summary>
    public partial class Login : Page
    {
        public Login()
        {
            try
            {
                InitializeComponent();
                this.userLogin.OnPageNavigation += new OnPageNavigation_Delegate(OnPageNavigation);
            }
            catch
            { }
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            while (this.NavigationService.CanGoBack == true)
            {
                this.NavigationService.RemoveBackEntry();
            }
        }

        private void OnPageNavigation(object sender, RoutedEventArgs e, int TypeOfUser)
        {
            switch (TypeOfUser)
            {
                case 0:
                    this.NavigationService.Navigate(new Uri("/NPCUS;component/pages/User.xaml", UriKind.Relative));

                    break;
                case 1:
                    this.NavigationService.Navigate(new Uri("/NPCUS;component/pages/Admin.xaml", UriKind.Relative));
                    break;
                //case 2:
                //  this.NavigationService.Navigate(new Uri("/NPCUS;component/pages/Root.xaml", UriKind.Relative));
                //break;

                default:
                    return;
            }
        }

        private void userLogin_Loaded(object sender, RoutedEventArgs e)
        {

        }
    }
}
